Release 10.1A: OpenEdge Development:
ADM and SmartObjects
Defining dynamic SmartLinks
Sometimes a SmartObject application requires a link that passes messages between SmartObjects more dynamically; that is, the particular message to be passed (and any resulting processing) is determined by an application user’s run-time choice. This type of link is a dynamic SmartLink.
When you define a dynamic SmartLink, you do not need to provide the support structure for standard events required for static SmartLinks (see the previous section for details). If, at design time, you define between two SmartObjects a SmartLink not in the SupportedLinks list for either object, the
addLinkprocedure registers the link as a subscription to an event of the same name as the links. (You also can do this programmatically, by runningaddLinkin application code.)The following example illustrates how to define a dynamic SmartLink. This SmartLink, called
ProcessCalc, links a simple SmartObject and a SmartDataObject, passing messages that invoke processing in the SmartDataObject. The particular message sent, and the processing invoked, are determined at run time by the choice of the application user.
![]()
To define the ProcessCalc dynamic SmartLink, in the AppBuilder:
- Create a SmartDataObject that contains an internal procedure named
ProcessCalcthat has the following code:
- Create the code for the
calcTotalsandcalcDiscountsprocedures.- Create a simple SmartObject called
sCalcPanel.wthat contains two buttons named Calculate Totals and Calculate Discounts, and add the following trigger code to these buttons:
- Create a SmartWindow.
- Drop the SmartDataObject onto the SmartWindow.
- Drop the
sCalcPanel.wsimple SmartObject onto the SmartWindow.- Add a SmartLink as follows:
When you run this application:
- Choosing the Calculate Totals button invokes
ProcessCalcin the SmartDataObject with theTotalsinput parameter, which runs thecalcTotalsprocedure.- Choosing the Calculate Discounts button invokes
ProcessCalcin the SmartDataObject with theDiscountsinput parameter, which runs thecalcDiscountsprocedure.Thus, the
ProcessCalcSmartLink is dynamic, in the sense that the link name is not bound to a set of event procedure names that are statically defined in the SmartObjects.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |